package org.lan.permission.dao.impl;

import java.util.List;

import org.lan.basic.impl.BaseDao;
import org.lan.permission.dao.IRolePermissionDao;
import org.lan.permission.entity.Permission;
import org.lan.permission.entity.RolePermission;
import org.springframework.stereotype.Repository;

@Repository
@SuppressWarnings("unchecked")
public class RolePermissionDao extends BaseDao<RolePermission>implements IRolePermissionDao {

	@Override
	public List<Permission> findByRoleId(Integer roleId) {
		String hql = "SELECT rp.permission FROM RolePermission rp WHERE rp.role.id = ?";
		return (List<Permission>) list(hql, roleId);
	}

}
